<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
/* @var $this \Magento\Wishlist\Block\Customer\Wishlist */
?>

<?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?>
    <?php echo($this->getChildHtml('wishlist.rss.link'));?>
    <form class="form-wishlist-items" id="wishlist-view-form"
          data-mage-init='{"wishlist":{
          "dataAttribute":"item-id",
          "nameFormat":"qty[{0}]",
          "btnRemoveSelector":".action.delete",
          "qtySelector":".qty",
          "addToCartSelector":".action.tocart",
          "addAllToCartSelector":".primary > .action.tocart",
          "commentInputType":"textarea",
          "infoList":false,
          "addToCartUrl":"<?php echo $this->getItemAddToCartUrl("%item%");?>",
          "confirmRemoveMessage":"<?php echo __("Are you sure you want to remove this product from your wishlist?") ?>",
          "addAllToCartUrl":"<?php echo $this->getAddAllToCartUrl(); ?>",
          "commentString":""},
          "validation": {}}' action="<?php echo $this->getUrl('*/*/update', array('wishlist_id' => $this->getWishlistInstance()->getId())) ?>" method="post">
        <?php echo $this->getChildHtml('top'); ?>
        <?php if ($this->hasWishlistItems()): ?>
            <?php echo $this->getBlockHtml('formkey');?>
            <?php $this->getChildBlock('items')->setItems($this->getWishlistItems()); ?>
            <?php echo $this->getChildHtml('items');?>
        <?php else: ?>
            <div class="message info empty"><span><?php echo __('You have no items in your wish list.') ?></span></div>
        <?php endif ?>
        <?php echo $this->getChildHtml('bottom'); ?>
        <div class="actions-toolbar">
            <div class="primary">
                <?php echo $this->getChildHtml('control_buttons');?>
            </div>
            <div class="secondary">
                <a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="action back">
                    <span><?php echo __('Back') ?></span>
                </a>
            </div>
        </div>
    </form>
    <script id="form-tmpl" type="text/x-handlebars-template">
        <form id="wishlist-hidden-form" method="post" action="{{url}}" class="no-display">
            {{#if itemId}}<input name="item_id" value="{{itemId}}">{{/if}}
            {{#if wishlistId}}<input name="wishlist_id" value="{{wishlistId}}">{{/if}}
            {{#if qty}}<input name="qty" value="{{qty}}">{{/if}}
            {{#if item}}<input name="item" value="{{item}}">{{/if}}
            {{#if entity}}<input name="entity" value="{{entity}}">{{/if}}
        </form>
    </script>
<?php endif ?>
